﻿CREATE TABLE [dbo].[Ticket] (
    [BookingId]     INT          NOT NULL,
    [CustomerId]    INT          NOT NULL,
    [SeatId]        INT          NOT NULL,
    [TicketClassId] INT          NOT NULL,
    [Status]        VARCHAR (50) NULL,
    CONSTRAINT [PK_Ticket_1] PRIMARY KEY CLUSTERED ([CustomerId] ASC, [SeatId] ASC, [TicketClassId] ASC),
    CONSTRAINT [FK_Ticket_BookingService] FOREIGN KEY ([BookingId]) REFERENCES [dbo].[BookingService] ([Id]),
    CONSTRAINT [FK_Ticket_Customer] FOREIGN KEY ([CustomerId]) REFERENCES [dbo].[Customer] ([CustomerId]),
    CONSTRAINT [FK_Ticket_Seat] FOREIGN KEY ([SeatId]) REFERENCES [dbo].[Seat] ([Id]),
    CONSTRAINT [FK_Ticket_TicketClass] FOREIGN KEY ([TicketClassId]) REFERENCES [dbo].[TicketClass] ([Id])
);

